
package com.hlkj.pay.infrastructure.model.order;
/*
 * Hlpay-Plus aggregate payment system.
 * Copyright (c) 2024-2025 Hlpay Team Copyright has the right of final interpretation.
 */

import java.math.BigDecimal;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hlkj.framework.mybatis.core.dataobject.BaseDO;
import com.hlkj.pay.enums.PayOrderEnums;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * @author HlpayTeam
 * @date 2024/10/10 13:22
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("t_order_pay")
public class PayOrderDO extends BaseDO {

    @Schema(description = "平台订单号")
    private String payOrderNo;

    /**
     * 商户订单号
     */
    @Schema(description = "商户订单号")
    private String mchOrderNo;

    /**
     * 机构订单号
     */
    @Schema(description = "机构订单号")
    private String insOrderNo;

    /**
     * 渠道交易订单号
     * WX:420 开头
     * ALI:2025 年份开头  28位数字
     */
    @Schema(description = "渠道订单号")
    private String channelOrderNo;

    /**
     * 渠道附加订单号
     */
    @Schema(description = "渠道附加订单号")
    private String channelOrderId;

    /**
     * 商户通道id
     */
    @Schema(description = "商户通道code")
    private String mchChannelCode;
    @Schema(description = "子商户id")
    private String subMchId;
    /**
     * 支付类型
     */
    @Schema(description = "支付类型")
    private String payType;

    /**
     * 支付方式
     */
    @Schema(description = "支付方式")
    private String paySubType;

    /**
     * 场景类型
     */
    @Schema(description = "场景类型")
    private Integer sceneType;

    /**
     * 支付方式编码
     */
    @Schema(description = "支付方式编码")
    private String payWayCode;

    /**
     * 订单金额
     */
    @Schema(description = "订单金额")
    private BigDecimal amount;

    /**
     * 订单金额
     */
    @Schema(description = "实际支付金额")
    private BigDecimal payAmount;

    /**
     * 客户端IP
     */
    @Schema(description = "客户端IP")
    private String clientIp;

    /**
     * 商品标题
     */
    @Schema(description = "商品标题")
    private String subject;

    /**
     * 商品描述信息
     */
    @Schema(description = "商品描述信息")
    private String description;

    /**
     * 特定支付方式额外参数
     */
    @Schema(description = "特定支付方式额外参数")
    private String extra;

    /**
     * 异步通知地址
     */
    @Schema(description = "异步通知地址")
    private String notifyUrl;

    /**
     * 页面跳转地址
     */
    @Schema(description = "页面跳转地址")
    private String redirectUrl;

    /**
     * 订单状态，1=初始化，2=支付中，3=支付成功，4=已撤销，5=订单关闭 6=支付失败，
     * @see com.hlkj.pay.enums.PayOrderEnums.PAY_ORDER_STATUS
     */
    @Schema(description = "订单状态，1=初始化，2=支付中，3=支付成功，4=已撤销，5=订单关闭 6=订单关闭中 7=支付失败")
    private Integer state;

    /**
     * 订单失效时间
     */
    @Schema(description = "订单失效时间")
    private Long expiredTime;

    /**
     * 订单成功时间
     */
    @Schema(description = "订单成功时间")
    private Long successTime;

    /**
     * 渠道支付错误码
     */
    @Schema(description = "渠道支付错误码")
    private String bankCode;

    /**
     * 渠道支付错误描述
     */
    @Schema(description = "渠道支付错误描述")
    private String bankMsg;

    /**
     * 商户商户号
     */
    @Schema(description = "商户商户号")
    private String sn;

    /**
     * 子商户号
     */
    @Schema(description = "交易商户号")
    private String orderSn;

    /**
     * 商户商户号
     */
    @Schema(description = "appid")
    private String appId;

    /**
     * 默认服务商
     */
    @Schema(description = "默认服务商")
    private String providerCode;

    /**
     * 默认通道
     */
    @Schema(description = "默认通道")
    private String channelCode;

    /**
     * 商户通道拓展
     */
    @Schema(description = "商户通道拓展")
    private String channelConfig;

    /**
     * 平台交易手续费
     */
    @Schema(description = "平台交易手续费")
    private BigDecimal feeAmount;

    /**
     * 机构交易手续费
     */
    @Schema(description = "机构交易手续费")
    private BigDecimal channelFeeAmount;

    /**
     * 实际结算金额
     */
    @Schema(description = "实际结算金额")
    private BigDecimal settlementAmount;

    /**
     * 平台手续费费率
     */
    @Schema(description = "平台手续费费率")
    private BigDecimal feeRate;

    /**
     * 机构手续费费率
     */
    @Schema(description = "机构手续费费率")
    private BigDecimal channelFeeRate;

    /**
     * 向下游回调状态, 0-未发送, 1-已发送'
     */
    @Schema(description = "向下游回调状态, 0-未发送,  1-已发送'")
    private Integer notifyState;


    /**
     *
     */
    @Schema(description = "手续费计算时间")
    private Long feeTime;

    /**
     *
     */
    @Schema(description = "通知时间")
    private Long notifyTime;

    /**
     * 用户ID
     */
    @Schema(description = "用户ID")
    private String userId;

    /**
     * 是否有退款，1 未退款 2 退款中 3 部分退款 4 退款完成
     */
    @Schema(description = "是否有退款，1 未退款 2 退款中 3 部分退款 4 退款完成")
    private Integer refundStatus;

    /**
     * 退款金额
     */
    @Schema(description = "退款金额")
    private BigDecimal refundAmount;

    /**
     * 是否分账，1=有，0=无
     * @see PayOrderEnums.FUND_PROCESS_TYPE
     */
    @Schema(description = "分账类型 ，0或空=无分账，1=实时分账，2=延时分账，3=商户 预设默认分账")
    private Integer fundProcessType;


    /**
     * @see PayOrderEnums.PAY_ORDER_SUBSIDY_TYPE
     */
    @Schema(description = "营销补贴类型 ，0或空=无营销，1=自定义金额立减，2=自定义金额补贴，3=代金券 4=满减券")
    private Integer marketProcessType;

    /**
     * 可分账金额
     */
    @Schema(description = "可分账金额")
    private BigDecimal orderSplitAmount;

    /**
     * 签名方式 RSA2,MD5
     */
    @Schema(description = "签名方式 RSA2,MD5")
    private String signType;

    /**
     * ATU真实商户号
     */
    @Schema(description = "AUT真实商户号")
    private String atuSubMerId;

    /**
     * 平台分账串
     */
    @Schema(description = "平台分账串")
    private String acctInfoJson;
    
    @TableField(exist = false)
    private String payInfo;
    @Schema(description = "支付数据类型，pay_url-支付链接，pay_url_form-支付链接强制必须跳转（直接访问链接跳转），wx_jspay-微信支付参数(微信公众号,小程序,app支付时)，ali_jspay-支付宝支付参数，ysf_jspay-云闪付支付参数，，bank_info-银行转账参数，code_url-二维码地址codeImg_url-二维码图片地址,none-空支付参数")
    @TableField(exist = false)
    private String payDataType;
    @TableField(exist = false)
    private String authCode;
    /**
     * @see PayOrderEnums.PAY_ORDER_TYPE
     */
    @Schema(description = "订单类型")
    private Integer orderType;

    @Schema(description = "关联单号")
    private String relationOrderNo;
    @Schema(description = "aut通道编码")
    private String autCode;

    @Schema(description = "营销信息串")
    private String marketingOrdersJson;

    @Schema(description = "清算状态，0=未清算，1=已清算")
    private Integer csState;
    @Schema(description = "清算时间")
    private Long csTime;

    @Schema(description = "采集信息JSON,key-value键值对")
    private String colletJson;

    @Schema(description = "订单备注")
    private String remark;

    @TableField(exist = false)
    private boolean pre;

}
